package com.seveneight.baijiesteward.ui.user.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.base.BaseActivity;
import com.seveneight.baijiesteward.base.TeamBean;
import com.seveneight.baijiesteward.utils.NumberUtil;

import butterknife.BindView;

public class TeamInfoActivity extends BaseActivity {

    @BindView(R.id.iv_back)
    ImageView iv_back;
    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.txt_name)
    TextView txt_name;
    @BindView(R.id.txt_phone)
    TextView txt_phone;
    @BindView(R.id.txt_rank_name)
    TextView txt_rank_name;
    @BindView(R.id.txt_auth_status)
    TextView txt_auth_status;
    @BindView(R.id.txt_money)
    TextView txt_money;
    @BindView(R.id.txt_register_time)
    TextView txt_register_time;
    @BindView(R.id.txt_parent_name)
    TextView txt_parent_name;
    @BindView(R.id.parent_name_layout)
    LinearLayout parent_name_layout;

    public int type=1;
    public TeamBean teamBean;
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_team_info);
        type=getIntent().getIntExtra("type",1);
        teamBean= (TeamBean) getIntent().getSerializableExtra("data");
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        if (type==1){
            tv_title.setText("我的直推详情");
            parent_name_layout.setVisibility(View.GONE);
        }else {
            tv_title.setText("我的间推详情");
        }
        txt_name.setText(teamBean.getRealName());
        txt_phone.setText(teamBean.getMobilePhone());
        txt_rank_name.setText(teamBean.getRankName());
        txt_auth_status.setText(teamBean.getAuthStatus().equals("-1")?"审核中":teamBean.getAuthStatus().equals("0")?"实名认证":teamBean.getAuthStatus().equals("1")?"已认证":"审核失败");
        txt_money.setText(NumberUtil.doubleToString(teamBean.getCommission())+"元");
        txt_register_time.setText(teamBean.getRegisterTime());
        txt_parent_name.setText(teamBean.getParentName());
        Glide.with(getContext())
                .load(teamBean.getHeadImgUrl()).error(R.mipmap.user_head)
                .into((ImageView)findViewById(R.id.ci_head));
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    protected void setListener() {

    }
}
